#include "rgbe.h"
#include <malloc.h>

inline float* LoadHDRI(const char *filename, int &xres, int &yres)
{
  //File Öffnen und HDRI einlesen
  FILE *f = fopen(filename,"rb");

  if (f)
  {
    RGBE_ReadHeader(f,&xres,&yres,NULL);
    float* hdr_picture = (float *)malloc(sizeof(float)*3*xres*yres);
    RGBE_ReadPixels_RLE(f,hdr_picture,xres,yres);

    fclose(f);
    return(hdr_picture);
  }
  else
  {
    xres=-1;
    yres=-1;
    return(0);
  }
}

